<template>
  <div class="wrap">
    <input type="text" class="form-control" v-model="value">
    <button class="btn" type="button" @click="handleAdd">添加</button>
  </div>
</template>


<script setup>
import { ref, defineEmits } from 'vue';

const value = ref('')
const emits = defineEmits(['add']) // 定义一个事件名称

const handleAdd = () => {
  emits('add', value.value) // 抛出这个事件
  value.value = ''
}
</script>

<style>

</style>